package com.technology.education.ui.student.study_record

import androidx.lifecycle.MutableLiveData
import com.technology.education.data.model.TeacherOrderListModel
import com.technology.education.network.apiService
import me.hgj.jetpackmvvm.base.viewmodel.BaseViewModel
import me.hgj.jetpackmvvm.ext.request
import me.hgj.jetpackmvvm.state.ResultState

class StudyRecordViewModel : BaseViewModel() {
    val result = MutableLiveData<ResultState<TeacherOrderListModel>>()
    val delResult = MutableLiveData<String>()
    override fun getData() {
        super.getData()
        request({
            apiService.teachOrderList(
                hashMapOf(
                    "pageNo" to pageIndex,
                    "pageSize" to pageSize
                )
            )
        }, result)
    }

    fun delOrder(id: String) {
        request({ apiService.delTeachOrder(id) }, success = {
            delResult.postValue(id)
        },isShowDialog = true)
    }
}